const path = require("path");
const express = require("express");
const app = express();

const PORT = 3000;
const options = {
  dotfiles: "ignore",
  etag: false,
  extensions: ["htm", "html"],
  index: ["index.html"],
  maxAge: "1d",
  redirect: false,
  setHeaders: function (res, path, stat) {
    res.set("x-timestamp", Date.now());
  },
};
app.use(express.static("./", options));

app.use("*", (req, res) => {
  res.sendFile(path.resolve(__dirname, "./index.html"));
});

app.listen(PORT, () => {
  console.log("server start up success, prot: ", PORT);
});
